try{
	var picStoreAction = ctx+"attachment/media/upload.action?isRemote=F";
	
	$(function(){
		$("#loadImg").hide();
	});
}catch(e){
	alert("请在引入此js页面中定义一个ctx变量，此变量值为当前项目路径！谢谢!!!");
}




function Supload(myPos,idname,callback){
	 if($("#sampleUW")){
		$("#sampleUW").replaceWith("");
	}
	 
	 var mydom = "<div id=\"sampleUW\" class=\"easyui-window\" "+
			 " iconCls=\"icon-ok\">" +
			 "<div class=\"easyui-layout\" fit=\"true\">"+
			 "<form target=\"uploadIframe\" name=\"uploadMedia\" id=\"uploadMedia\" action=\""+picStoreAction+"\" method=\"POST\" enctype=\"multipart/form-data\">";
	 if(callback){
		 mydom+= "<input type=\"hidden\"  name=\"callback\" value="+callback+ "/>";
	 }
	 mydom+= "<span id=\"upLable\"></span>附件：<input type=\"file\" name=\"upload\" id=\"uploadP\"/>"+
			 "<input type=\"hidden\" id=\"idname\" name=\"idname\" value=\""+idname+"\"/>"+
			 "<input type=\"button\" onclick=\"uploadFile();\" style=\"width:80px;\"  value=\"上传\"/>"+
			 "<input type=\"button\" onclick=\"clo();\" style=\"width:80px;\" value=\"关闭\"/>"+
			 "</form>"+
			 "<iframe name=\"uploadIframe\" frameborder=0  height=0 width=0></iframe>" +
/*			"<div id=\"loadImg\">"+
				"<img src=\""+ctx+"\/js/jquery-easyui/themes/default/images/pagination_loading.gif\"><font color=\"#827192\">病毒扫描中,请稍后...</font>"+
			"</div>"+*/
			 "</div>";
	 if($("#sampleUW").attr("class")!=undefined){
	 	$("#idname").val(idname);
		resizeWin('sampleUW','附件上传');
	 }else{
		 $("body").append(mydom);
		 resizeWin('sampleUW','附件上传');
	 }
}
function resizeWin(sw,tit){
	$('#'+sw).window({
					title: tit,
					width: 450,
					modal: false,
					shadow: false,
					closed: false,
					height: 100
		 });
}


function clo(){
	 $("#sampleUW").window("close");
}
function messgeDis(idname,flag,msg,murl){
	//alert("idname"+idname+"---"+"flag"+flag+"---"+"msg"+msg+"---"+"murl"+murl);
	if(flag == "T"){
		 $.messager.alert("上传结果",msg, "info");
		 $("#"+idname).val(murl);
		 $("#loadImg").hide();
		 $('#sampleUW').window('close');
	}else{
		sampleErrorMsg(msg);
		$("#loadImg").hide();
		 $('#sampleUW').window('close');
	}
}
function togWHtext(){
	$("#whdivupl").toggle();
}
function sampleErrorMsg(msg){
	$("#loadImg").hide();
		$.messager.alert("错误提示",msg, "error");
}

function uploadFile(){
	var uploadP = $("#uploadP");
	if(uploadP.val() == null ||  $.trim(uploadP.val()).length == 0){
		sampleErrorMsg("请选择要上传的文件!");
		return;
	}	
	$("#loadImg").show();
	document.getElementById("uploadMedia").submit();
}